import Page
from Page import Personal
from Base.Base import Base
from selenium.webdriver.common.by import By


class PersonalCertificationPage(Base):
    """
    个人中心认证界面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 认证车牌标题
        self.certification_title_text = (By.XPATH, Personal.RESOURCE_ID.format("confirm_dialog_title"))

        # 认证车牌文案
        self.certification_content_text = (By.XPATH, Personal.RESOURCE_ID.format("login_scan_qrcode_fl"))

        # 确认按钮
        self.certification_sure_btn = (By.XPATH, Personal.RESOURCE_ID.format("btn_confirm_sure"))

    def get_title(self):
        """
        获取名称标题

        :return:
        """
        return self.find_element_o(self.certification_title_text)

    def get_content(self):
        """
        获取认证车牌文案

        :return:
        """
        return self.find_element_o(self.certification_content_text)

    def click_sure(self):
        """
        点击确认按钮

        :return:
        """
        self.click_element(self.certification_sure_btn)

    def is_display_personal_certification(self):
        """
        是否存在认证车牌页

        :return: bool
        """
        return self.is_display(self.certification_title_text)
